Skip to content

Conversation

@matifali
Copy link
Member

@matifali matifali commented Oct 30, 2025

Moves the strict error handling flags after sourcing user bashrc files to prevent failures from unbound variables in user dotfiles. This is especially important when users load dotfiles from git.

Fixes agentapi server startup failures caused by BASHRCSOURCED and other unbound variables in /etc/bashrc or user-specific bashrc files.

Moves the strict error handling flags after sourcing user bashrc files
to prevent failures from unbound variables in user dotfiles. This is
especially important when users load dotfiles from git.

Fixes agentapi server startup failures caused by BASHRCSOURCED and
other unbound variables in /etc/bashrc or user-specific bashrc files.
@matifali matifali requested a review from 35C4n0r October 30, 2025 14:50
@matifali matifali changed the title fix: Move set -euo pipefail after sourcing bashrc fix: move set -euo pipefail after sourcing bashrc Oct 30, 2025
@matifali matifali changed the title fix: move set -euo pipefail after sourcing bashrc fix(coder/modules/claude-code): move set -euo pipefail after sourcing .bashrc Oct 30, 2025
@matifali matifali added the version:patch Add to PRs requiring a patch version upgrade label Oct 30, 2025
@35C4n0r
Copy link
Collaborator

35C4n0r commented Oct 30, 2025

@matifali @DevelopmentCats
I recently(while building the opencode module) found out that this dosen't work in a shell script

if [ -f "$HOME/.bashrc" ]; then
  source "$HOME"/.bashrc // This line 
fi

This line in the bashrc prevents sourcing the bash script if we are in non-interactive mode

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

@DevelopmentCats
Copy link
Contributor

DevelopmentCats commented Oct 30, 2025

@matifali @DevelopmentCats I recently(while building the opencode module) found out that this dosen't work in a shell script

if [ -f "$HOME/.bashrc" ]; then
  source "$HOME"/.bashrc // This line 
fi

This line in the bashrc prevents sourcing the bash script if we are in non-interactive mode

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

Wow you are totally right about this, Great Catch!

So basically right now those lines are essentially doing nothing haha.

@matifali
Copy link
Member Author

I guess then it's good to merge?

@35C4n0r
Copy link
Collaborator

35C4n0r commented Oct 30, 2025

Yup, The other modules that are working right now, are due to the other exports that we have along sourcing of the bash file.

@matifali
Copy link
Member Author

Yup, The other modules that are working right now, are due to the other exports that we have along sourcing of the bash file.

@35C4n0r, please feel free to go through all of them to fix this.

@matifali matifali merged commit 5450113 into main Oct 30, 2025
4 checks passed
@matifali matifali deleted the fix-bashrc-unbound-vars branch October 30, 2025 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:patch Add to PRs requiring a patch version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants